package com.tasks.tablemodel;

import org.apache.log4j.Logger;
import com.tasks.server.Executor;
import com.tasks.server.Server;
import com.tasks.table.Task;
import com.tasks.table.User;

public class Tasks extends DefaultTableModel {
	
	static Logger logger = Logger.getLogger(Tasks.class); 
	private static final long serialVersionUID 	= -3849092076409015369L;
	
	public void fetchByUser(Server s, User u)
	{
		Executor executor = new Executor(s); 
		
		String sql = "SELECT * " 
		   	   	   + "FROM TASK "
		   	   	   + "WHERE USER = " + u.getPrimaryKey().toString() + ";";
		
		set(s, Task.class, sql);
		
		executor.close();
		executor = null;
	}
}
